package goodenglish.interfaces;

import goodenglish.domain.model.subt.Subt;
import goodenglish.domain.model.subt.SubtRepository;
import goodenglish.infrastructure.repository.db.SubtRepositoryDb;
import javafx.scene.control.ChoiceBox;

/**
 * 得到字幕选择框
 * 
 * @author hp
 * 
 */
public class SubtChoiceBox extends ChoiceBox<Subt> {
	public SubtChoiceBox() {
		SubtRepository subtRepository =BeanFactory.getSingleInstance(SubtRepositoryDb.class);
		this.getItems().addAll(subtRepository.findSubts());
		this.getSelectionModel().selectFirst();
	}

	public Subt getSelectSubt() {
		return (Subt) this.getSelectionModel().getSelectedItem();
	}
}
